; (function (ns) {
    ZYCLib.RegNameSpace(ns).UserSignOut = (function () {
        var SignOuting = false;
        $("#btnSignOut").click(function (event) {
            if (SignOuting) {
                ZYCLib.UI.MessageBox.Alert("正在退出登录，请稍等", 0, function () { });
                return false;
            }
            SignOuting = true;

            var params =
                {
                    CommandName: "UserSignService/SignOut",
                    Data: { }
                };
            ZYCLib.Web.JsonAjax.NPostData(params.CommandName, params.Data,
                function (jsondata) {
                    if (jsondata != null) {
                        if (jsondata.ErrorCode === 0) {
                            ZYCLib.CrossDomain.SingleSignOn.SignOut(function () {
                                SignOuting = false;
                                var oldUrl = window.location.href;
                                window.location.href = "https://secure" + ZYCLib.Domain + "/signin/login?returnurl=" + encodeURIComponent(oldUrl);
                            });
                        }
                    }
                }
            );

            event.stopPropagation();
            return false;
        });
    })();
})("Page");